﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DAL;
using Common;
using Model;
namespace BLL
{
    public class SysOperationLog: BaseBLL
    {
        public SysOperationLog(LoginInfo info)
        {
            loginInfo = new LoginInfo();
        }

        public bool InitLogin() {
            try
            {
               return new DAL.SysOperationLog(loginInfo).InitLogin();
            }
            catch (Exception ex)
            {
                throw ex;
            } 
        }
        /// <summary>
        /// 记录操作日志
        /// </summary>
        /// <param name="ParentID">ParentID</param>
        /// <param name="OperationIP">OperationIP</param>
        /// <param name="OperationAction">OperationAction</param>
        /// <param name="OperationStatus">OperationStatus</param>
        /// <param name="OperationResult">OperationResult</param>
        /// <param name="OperationUser">OperationUser</param>
        public void Log(string ParentID, OperationAction OperationAction, OperationStatus OperationStatus, string OperationResult, string OperationUser)
        {
            try
            {
                string ip = string.Empty;

                new DAL.SysOperationLog(loginInfo).Log(ParentID, ip, OperationAction.ToString(), OperationStatus, OperationResult, OperationUser);
            }
            catch (Exception ex)
            {
                Logger.LogError("SysOperationLog", "Log", AppError.EROR, 0, ex, "记录Log信息出错。", "");
            }
        }
        public void Log(string ParentID, string UserIP, OperationAction OperationAction, OperationStatus OperationStatus, string OperationResult, string OperationUser)
        {
            try
            {
                new DAL.SysOperationLog(loginInfo).Log(ParentID, UserIP, OperationAction.ToString(), OperationStatus, OperationResult, OperationUser);
            }
            catch (Exception ex)
            {
                Logger.LogError("SysOperationLog", "Log", AppError.EROR, 0, ex, "记录Log信息出错。", "");
            }
        }
    }
}
